package com.android.functionmanagement.ui;

import com.uwatch.helowin.R;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * We will use a SpeechView to display each speech. It's just a LinearLayout
 * with two text fields.
 * 
 */
public class SpeechView extends LinearLayout {

	/**
	 * 
	 * @param context
	 * @param attrs
	 */
	public SpeechView(Context context, AttributeSet attrs) {
		super(context, attrs, 0);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.view.View#onFinishInflate()
	 */
	@Override
	protected void onFinishInflate() {
		// TODO Auto-generated method stub
		super.onFinishInflate();
		mTitle = (TextView) findViewById(R.id.sp_title);
		mDialogue = (TextView) findViewById(R.id.sp_dialogue);
	}

	/**
	 * Convenience method to set the title of a SpeechView
	 */
	public void setTitle(String title) {
		mTitle.setText(title);
	}

	/**
	 * Convenience method to set the dialogue of a SpeechView
	 */
	public void setDialogue(String words) {
		mDialogue.setText(words);
	}

	/**
	 * Convenience method to expand or hide the dialogue
	 */
	public void setExpanded(boolean expanded) {
		mDialogue.setVisibility(expanded ? VISIBLE : GONE);
	}

	private TextView mTitle;
	private TextView mDialogue;
}
